{template 'common/header'}
<ol class="breadcrumb we7-breadcrumb">
	<a href="{php echo $this->createWebUrl('category');}"><i class="wi wi-back-circle"></i> </a>
	<li>
		<a href="{php echo $this->createWebUrl('category');}">类别管理</a>
	</li>
	<li>
		添加类别
	</li>
</ol>
<div class="clearfix">
	<form action="{php echo $this->createWebUrl('categorysave')}" method="post" class="we7-form" role="form" id="form1">
		<input type="hidden" name="cat_id" value="{$category['cat_id']}"/>
			<div class="form-group">
				<label class="col-sm-2 control-label">类别名称</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" name="cat_name" value="{$category['cat_name']}" placeholder="类别名称"/>
					<div class="help-block">请填写类别名称</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">缩略图</label>
				<div class="col-sm-8">
					{php echo tpl_form_field_image('cat_logo', $category['cat_logo']);}
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">排序</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" name="cat_sort" value="{$category['cat_sort']}" placeholder="排序"/>
					<div class="help-block">数字越大，越靠前。</div>
				</div>
			</div>
		<div class="form-group">
			<div class="">
				<input type="submit" class="btn btn-primary"  value="提交" />
			</div>
		</div>
	</form>
</div>
<script>
	$(function(){
		$('#form1').submit(function(){
			if(!$.trim($(':text[name="cat_name"]').val())) {
				util.message('请填写类别名称', '', 'error');
				return false;
			}
			if(!$.trim($(':text[name="cat_logo"]').val())) {
				util.message('请上传图标', '', 'error');
				return false;
			}
			return true;
		});
	});
</script>
{template 'common/footer'}
